package com.service;

import io.seata.rm.tcc.api.BusinessActionContext;
import io.seata.rm.tcc.api.BusinessActionContextParameter;
import io.seata.rm.tcc.api.LocalTCC;
import io.seata.rm.tcc.api.TwoPhaseBusinessAction;

/**
 * @description:
 * @author: sksun2
 * @create: 2023-08-04
 */
@LocalTCC
public interface OrderTccService {

    @TwoPhaseBusinessAction(name = "createTccOrder",commitMethod="commit",rollbackMethod = "cancel")
    boolean tryCreate(@BusinessActionContextParameter(paramName = "userId")String userId,
                      @BusinessActionContextParameter(paramName = "itemId")String itemId,
                      @BusinessActionContextParameter(paramName = "num")Integer num);

    boolean commit(BusinessActionContext context);

    boolean cancel(BusinessActionContext context);


}
